myApp.controller('selectContentCtrl', function ($rootScope, $scope, $http, $uibModalInstance, httpService, formBoxData) {
	
	/*关闭的图片*/
	$scope.closeImg={'img':'images/close-default.png','defaultImg':'images/close-default.png','downImg':'images/close-btndown.png','hoverImg':'images/close-hover.png'};
    $scope.title = formBoxData.title;
    $scope.formData = {};


    $scope.headTitle=[
        {
            name:'巡检项目',
            filed:'sysName',
            width:'25%'
        },
        {
            name:'巡检内容',
            filed:'content',
            width:'10%'
        },
        {
            name:'结果类型',
            filed:'resultTypeLocal',
            width:'10%'
        },
        {
            name:'备注',
            filed:'remark',
            width:'20%'
        }

    ];
    //选中的id
    $scope.selectedIds=$scope.selectList.map(function(item,index){
        return item.id;
    });
    console.log($scope.selectedIds);

    $scope.list=[
        {
            id:'123123',
            sysName:"cpu1",
            content:"检查cpu是否发热",
            resultTypeLocal:"是否",
            remark:"测试的备注"
        },
        {
            id:'456456',
            sysName:"cpu2",
            content:"检查cpu是否发热",
            resultTypeLocal:"是否",
            remark:"测试的备注"
        },
        {
            id:'789789',
            sysName:"cpu3",
            content:"检查cpu是否发热",
            resultTypeLocal:"是否",
            remark:"测试的备注"
        },
        {
            id:'147147',
            sysName:"cpu4",
            content:"检查cpu是否发热",
            resultTypeLocal:"是否",
            remark:"测试的备注"
        }
    ];


    $scope.list.map(function(item,index){
        item['checked']=false;
        return item;
    });


    // 保存
    $scope.ok = function () {
        $scope.selectItems=$scope.list.filter(function(item,index){
            return item.checked;
        });

        $rootScope.$broadcast('selectTemplateContent',{
            list:$scope.selectItems
        });
        $uibModalInstance.close();
    };
    // 取消
    $scope.cancel = function () {
        $uibModalInstance.dismiss('cancel');
    };
});
